package top.zhangjianyong.tools.service.api.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.zhangjianyong.tools.service.api.HolidayService;
import top.zhangjianyong.tools.utils.ApiResponse;
import top.zhangjianyong.tools.utils.HolidayUtil;

import java.time.LocalDate;

@Slf4j
@Service
public class HolidayServiceImpl implements HolidayService {

    @Autowired
    private HolidayUtil holidayUtil;


    @Override
    public ApiResponse check(Integer num) {
        LocalDate date = LocalDate.now().plusDays(num);
        boolean workDay = holidayUtil.isWorkDay(date);
        return ApiResponse.success(workDay);
    }
}
